package org.blame;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;

import java.util.List;

public class JedisDemoString {

    public static void main(String[] args) {
        JedisPool jedisPool=new JedisPool("tcp://127.0.0.1:8888");
        try(Jedis jedis=jedisPool.getResource()){
//            test1(jedis);
//            test2(jedis);
            test3(jedis);



        }
    }

    public static void test3(Jedis jedis){
        jedis.flushAll();
        jedis.set("k","213");
        long k = jedis.incr("k");
        String string = jedis.get("k");
        System.out.println(k);
        System.out.println(string);
        k = jedis.decr("k");
        String string1=jedis.get("k");
        System.out.println(k);
        System.out.println(string1);
    }
    public static void test2(Jedis jedis){
        jedis.flushAll();
        jedis.set("k","fdsfgdfs");
        jedis.append("k","1111");
        String s = jedis.get("k");
        System.out.println(s);
    }
    public static void test1(Jedis jedis){
        jedis.flushAll();
        String k = jedis.mset("s", "1", "s2", "2", "s3", "3");
        System.out.println(k);
        jedis.set("k","dsfdssdfds");
        String k1 = jedis.getrange("k", 2, 5);
        System.out.println(k1);

        jedis.setrange("k", 2, "ppp");
        String s = jedis.get("k");
        System.out.println(s);
    }

}
